﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace StudentApartMentManage
{
    public partial class SeekAdmin : Form
    {
        public SeekAdmin()
        {
            InitializeComponent();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("你这的要清空输入的信息吗?", "警告", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                textBox1.Clear();
                textBox2.Clear();
                comboBox1.Text = "";
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                string sql = string.Format("select * from 公寓管理员信息表 where 管理员ID like '{0}%' and 姓名 like '{1}%' and 性别 like '{2}%'", textBox1.Text.Trim(), textBox2.Text.Trim(), comboBox1.Text.Trim());
                dataGridView1.DataSource = sqlHelper.GetTable(sql);
                MessageBox.Show("查询成功!");

            }catch(Exception ex)
            {
                MessageBox.Show("查询失败!");
                return;
            }
        }
    }
}
